Make date time handling slightly more permissive
authorTom Wilkie <tom.wilkie@gmail.com>
Tue, 10 Apr 2007 16:01:40 +0000 (17:01 +0100)
committerTom Wilkie <tom.wilkie@gmail.com>
Tue, 10 Apr 2007 16:01:40 +0000 (17:01 +0100)
signed-off-by: Tom Wilkie <tom.wilkie@gmail.com>

tools/python/xen/xm/main.py

index 3dca2ee243cf011303c996ab08828c67d476da59..337d2a6a7517bcbafa80f7578321be5b2215b36d 100644 (file)
@@ -732,8 +732,10 @@ def xm_restore(args):
 
 
 def datetime_to_secs(v):
-    return time.mktime(time.strptime(str(v) + 'UTC', '%Y%m%dT%H:%M:%S%Z'))
-
+    unwanted = ":-."
+    for c in unwanted:
+        v = str(v).replace(c, "")
+    return time.mktime(time.strptime(v[0:14], '%Y%m%dT%H%M%S'))
 
 def getDomains(domain_names, state, full = 0):
     if serverType == SERVER_XEN_API: